function login(cfg){
	var uname = document.getElementById('userName').value;
	var upasswd = document.getElementById('password').value;
	var verifyCode = document.getElementById('verifyCode').value;
	
	cfg.onSuccess = function(rs,opts){
		params = null;
		window.location.href = 'desktop.jsp';
	};
	
	Ext.Ajax.request({
	    url: 'Service?t='+new Date().getTime(),
	    params : {
	    	'userName' : uname,
	    	'password' : upasswd,
	    	'verifyCode' : verifyCode,
	    	'module' : 'platform',
	    	'action' : 'login'
	    },
	    method : 'POST',
	    success : function(response, opts){
	      	var rs = response.responseText?Ext.decode(response.responseText):{};		
			if(rs.success){
				if(Ext.isFunction(cfg.onSuccess)){
					Ext.Function.bind(cfg.onSuccess,cfg.scope||window,[rs, opts])();
				}
			}else{
				reloadvaildcode();
				alert(rs.msg || 'SYSTEM ERROR');
			}				
      },
      failure : function(response, opts){
			reloadvaildcode();
			var rs = response.responseText?Ext.decode(response.responseText):{};
			alert(rs.msg || 'SYSTEM ERROR');
      }
	});
}


function resetform(){
	document.forms[0].reset();
}

function reloadvaildcode(){
    var a = document.getElementById("verifyCodeImg"); 
    a.setAttribute('src','verifyCode?t='+Math.random());
	
}
